# Contributor: Jakub Jirutka <jakub@jirutka.cz>
# Maintainer: Jakub Jirutka <jakub@jirutka.cz>
pkgname=ruby-liquid
_gemname=liquid
# NOTE: Before bumping, check version required by jekyll.
pkgver=4.0.3
pkgrel=2
pkgdesc="A secure, non-evaling end user template engine with aesthetic markup"
url="https://shopify.github.io/liquid/"
arch="noarch"
license="MIT"
depends="ruby"
checkdepends="ruby-minitest ruby-rake"
source="https://github.com/Shopify/liquid/archive/v$pkgver/$pkgname-$pkgver.tar.gz
	tests-disable-stack-profiler.patch
	tests-disable-tests-broken-on-ruby-2.7.patch
	tests-fix-parse-tree-visitor-on-ruby-3.patch
	tests-disable-liquid-c.patch
	gemspec.patch
	"
builddir="$srcdir/$_gemname-$pkgver"

build() {
	gem build $_gemname.gemspec
}

check() {
	rake test
}

package() {
	local gemdir="$pkgdir/$(ruby -e 'puts Gem.default_dir')"
	local geminstdir="$gemdir/gems/$_gemname-$pkgver"

	gem install \
		--local \
		--install-dir "$gemdir" \
		--ignore-dependencies \
		--no-document \
		--verbose \
		$_gemname

	# Remove unnecessary files and rubbish...
	cd "$gemdir"
	rm -r cache build_info doc extensions
}

sha512sums="
5aed3b98fa486a00744e0225f7a3b8004be8ded1e3347f9118fd062684fe33b725b84d1f88bdd5e881399e6efa60b4aa32f57cf10f4583aa27ec8c8288b52bf9  ruby-liquid-4.0.3.tar.gz
db4531548b84e463fbf2c03a6d96f6a72ff6103b8ea822866359d010770c645c75a68224b952640f21f1575a5d141cdf4121a4cb7155bc1578ea8309f0ba8aec  tests-disable-stack-profiler.patch
47be847a588959471865d228deda8d03b6178c4b3c66006d8cf77550666ab6b94c7a99c47979c87a2ef6af6c6de1fbd827fffbf4cdb342bb06c160ba3dfb6f32  tests-disable-tests-broken-on-ruby-2.7.patch
7d63083246a253f5198082c9fe0f7b76397ac4101abbcd39c9b29e68a776ebe38187bf329c2cf0432b38a496a9264ae5e6668d6e19c3b78b3725d36e1b420512  tests-fix-parse-tree-visitor-on-ruby-3.patch
c4cee2d4ae636712d42ac14c4f12794eae754cc7c4075fb726a214db25352ae4142e90dff3c3c9d148935462ef9faa78dd76c58a21a3c0d32ead9b34098c942d  tests-disable-liquid-c.patch
aececff77a9d267e30573449734a6f21986c1860481e1d91b862727106e39df199698ef46a18196cab515f39842635e5ae0b732c3655da98a988e91a769b2d89  gemspec.patch
"
